#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s >> t;
  int len = s.size();
  for (int i = 1; i < len; i++) {
    if (isupper(s[i])) {
      if (t.find(s[i - 1]) == string::npos) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;

  return 0;
}
